<template>
<view class="container">
<view v-for="(item, idx) in reverseList" :key="idx" @tap="toDetail" class="act_sec" :data-recruit-id="item.reserve.id">
    <view class="img_sec">
        <image class="thumb" mode="aspectFill" :src="item.thumb"></image>
    </view>
    <view class="title">{{item.reserve.title}}</view>
    <view class="desc">{{item.reserve.content}} ｜ <text>面积：</text>{{item.reserve.area}}平</view>
</view>
<view class="no_data" v-if="reverseList.length===0">暂无数据~</view>
<view class="no_more" v-if="reverseList.length!==0&&noMore">没有更多数据了~</view>
</view>
</template>

<script>
var t = require("../../../utils/request.js"),
		config = require("../../../utils/config.js").config,
    a = function (t) {
  return t && t.__esModule ? t : {
    default: t
  };
}(require("../../../utils/api.js")),
		utils = require("../../../utils/util.js"),
    app = getApp();
		
		import {myReserve} from "@/api/reserveManage";

export default {
  data() {
    return {
      page: 1,
      pageSize: 10,
      reverseList: [],
      noMore: !1
    };
  },

  components: {},
  props: {},
  onLoad: function (t) {
    var that = this;
    myReserve({pageSize: this.pageSize, pageNo: this.page,uid: app.globalData.zyzId}).then((result => {
      if (result.success) {
        result.data.length < 10 && that.setData({
          noMore: !0
        });
        result.data.forEach(function (single) {
					single.thumb = utils.formatImgUrl(single.reserve.imageUrl, config.host);
				}); 
				that.setData({reverseList: result.data});
      }
    }));
  },
  onPullDownRefresh: function () {
    var that = this;
    this.setData({
      page: 1,
      noMore: !1
    });
		myReserve({pageSize: this.pageSize, pageNo: this.page,uid: app.globalData.zyzId}).then((result => { 
      if (result.success) {
				result.data.length < 10 && that.setData({
				  noMore: !0
				});
				result.data.forEach(function (single) {
					single.thumb = utils.formatImgUrl(single.imageUrl, config.host);
				}); 
				that.setData({reverseList: result.data});
        uni.stopPullDownRefresh();
      }
    }));
  },
  onReachBottom: function () {
    var t = this;

    if (!this.noMore) {
      var a = this.page;
      this.setData({
        page: ++a
      });
			myReserve({pageSize: this.pageSize, pageNo: this.page,uid: app.globalData.zyzId}).then((result => { 
        if (result.success) {
          result.data.length < 10 && that.setData({
            noMore: !0
          });
          result.data.forEach(function (single) {
          	single.thumb = utils.formatImgUrl(single.imageUrl, config.host);
          }); 
          that.setData({reverseList: result.data});
        }
      }));
    }
  },
  methods: {
    toDetail: function (t) {
      uni.navigateTo({
        url: "/pages/reserve/detail?id=" + t.currentTarget.dataset.recruitId
      });
    }
  }
};
</script>
<style>
page {
    width: 100%;
    height: auto;
    min-height: 100%;
    background: #f4f4f4;
    padding-top: 100rpx;
    padding-bottom: 60rpx;
}

.select_wrapper {
    position: fixed;
    top: 0;
    /*  #ifdef  H5  */
    top:88rpx;
    /*  #endif  */
    left: 0;
    z-index: 99;
    width: 100%;
    height: 100rpx;
    justify-content: flex-start;
    background: #fff;
    border-top: 1rpx solid #e1e2e3;
    background: #f4f4f4;
    margin-bottom: 20rpx;
    padding-bottom: 10rpx;
}

.select_wrapper picker {
    flex: 0 0 33.33%;
    width: 33.33%;
    height: 90rpx;
}

.select_wrapper picker.double {
    flex: 0 0 50%;
    width: 50%;
    height: 90rpx;
}

.select_wrapper .select_sec {
    width: 100%;
    height: 90rpx;
    background: #fff;
}

.select_wrapper picker+picker>.select_sec {
    border-left: 1rpx solid #e1e2e3;
}

.select_sec .txt {
    flex: none;
    height: 100%;
    line-height: 90rpx;
}

.select_sec image {
    flex: 0 0 12rpx;
    width: 12rpx;
    height: 6rpx;
    margin-left: 12rpx;
}

.act_sec {
    width: 100%;
    min-height: 445rpx;
    height: auto;
    padding: 30rpx;
    margin-bottom: 10rpx;
    background: #fff;
}

.img_sec {
    position: relative;
    width: 100%;
    height: 280rpx;
    margin-bottom: 30rpx;
}

.img_sec .tag {
    position: absolute;
    top: -8rpx;
    left: -8rpx;
    z-index: 3;
    width: 160rpx;
    height: 52rpx;
}

.img_sec .tag image {
    z-index: 4;
}

.img_sec .tag image,.img_sec .tag text {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.img_sec .tag text {
    z-index: 5;
    text-align: center;
    line-height: 48rpx;
    font-size: 24rpx;
    color: #fff;
}

.img_sec .thumb {
    width: 100%;
    height: 100%;
    border: 1rpx solid #e1e2e3;
    border-radius: 10rpx;
}

.img_sec .headimg {
    position: absolute;
    bottom: -40rpx;
    right: 30rpx;
    z-index: 5;
    width: 80rpx;
    height: 80rpx;
    border-radius: 50%;
}

.act_sec .title {
    width: 100%;
    margin-bottom: 20rpx;
    font-size: 32rpx;
    color: #333;
}

.act_sec .desc,.act_sec .title {
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.act_sec .desc {
    font-size: 24rpx;
}

.container {
	margin-top: -48px !important;
}
</style>